﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Lm.Common.DAL.Sql
{
    public class SqlParameterManager
    {
        public List<SqlParameter> SqlParameterList { get; set; }
        protected int Count { get; set; }
        public SqlParameterManager(List<SqlParameter> sqlParameterList)
        {
            this.Count = 0;
            this.SqlParameterList = sqlParameterList;
        }
        public SqlParameter Create(object value)
        {
            this.Count++;
            SqlParameter parameter = new SqlParameter("@p" + this.Count, value);
            if (parameter.Value == null)
            { parameter.Value = DBNull.Value; }
            this.SqlParameterList.Add(parameter);
            return parameter;
        }
    }
}
